package com.bicon.botu.mall.coupon.api;

import com.bicon.botu.core.base.common.entity.BaseResult;
import com.bicon.botu.mall.coupon.common.CouponStatus;
import com.bicon.botu.mall.coupon.entity.Coupons;
import com.bicon.botu.mall.coupon.service.ICouponsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 吕祥
 * @date 2017/7/28 16:11
 */
@RestController
@RequestMapping(value = "/V1.0.0/api/Coupons")
public class CouponsApi {

    @Autowired
    ICouponsService iCouponsService;

    /**
     * 查询所有在发行期内的优惠券
     *
     * @return 所有在发行期内的优惠券
     */
    @RequestMapping(value = "/findAll", method = RequestMethod.GET)
    public BaseResult findAllRedis() {
        List<Coupons> couponsList = iCouponsService.findAllRedis();
        return new BaseResult(CouponStatus.RESPONSE_CODE_200, CouponStatus.RESPONSE_MESSAGE_200, couponsList);
    }
}
